<%@page contentType="text/html;charset=UTF-8"%>
<%@ page import="whf.framework.web.Constants"%>
<%@ page import="whf.survey.entity.SurveyTopic" %>

<%@taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean"%>
<%@taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html"%>
<%@taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic"%>
<%@taglib uri="/WEB-INF/tlds/framework.tld" prefix="framework"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"    "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title><framework:attr source="STRUTS-META" attr="name" /></title>
<jsp:include page="/common/inc/select.jsp" />
</head>
<%
long surveyId = whf.framework.util.ParamUtils.getLongParameter(request, "surveyId", 0);
String queryString = "t.survey.id="+surveyId+" order by t.sortOrder";
 %>
<body>
<html:form action='<%=  (String)request.getAttribute(Constants.STRUTS_PATH) %>' method="post">
<html:hidden property="webMethod" value="answer" />
<html:hidden property="id" />
<framework:ext />
<framework:table pkStyle="" loadLazyData="true" hideTitleRow="true" boClassName="whf.survey.entity.SurveyTopic" queryString="<%= queryString %>" id="surveyTopics">
	<framework:caption><span class="whf_object_title"><framework:attr source="STRUTS-META" attr="name" /></span></framework:caption>
	<framework:column property="id">
		<table width='100%' cellspacing='0' cellpadding='0'>
			<tr bgcolor='#EFEFEF'>
				<TD width='5%'><b>主题</b></TD><TD width='*%'>${name}</TD>
				<TD width='5%'><b>类型</b></TD><TD width='10%'><framework:attr source="currentRow" attr="choiceType" dictKind="SURVEY-CHOICE-TYPE" /></TD>
			</tr>
			<tr bgcolor='#EFEFEF'>
				<TD width='5%'><b>说明</b></TD><TD colspan="3">${remarks}</TD>
			</tr>
		</table>
		<input type='hidden' name='topic' value='<framework:attr source="currentRow" attr="id" />'>
		<%
		SurveyTopic topic = (SurveyTopic)request.getAttribute("currentRow");
		pageContext.setAttribute("topic", topic);
		String pkStyle = "checkbox";
		if("01".equals(topic.getChoiceType())) pkStyle = "radio";
		String namePrefix = "topic"+topic.getId();
		request.setAttribute("choices", topic.getSortChoices());
		%>
		<logic:equal name="topic" property="choiceType" value="00">
			<textarea rows='4' cols='90' name="topic<framework:attr source="currentRow" attr="id" />id"></textarea>
		</logic:equal>
		<logic:notEqual name="topic" property="choiceType" value="00">
			<framework:table namePrefix="<%= namePrefix %>" id="choices" pkStyle="<%= pkStyle %>" dataSourceName="choices" >
				<framework:column property="name" displayTitle="名称" />
				<framework:column property="remarks" displayTitle="说明" />
			</framework:table>
		</logic:notEqual>
	</framework:column>
</framework:table>

<logic:present parameter="view">
	<input type='button' value="返回" onclick="window.history.back()">
</logic:present>
<logic:notPresent parameter="view">
	<framework:funcbtn operation="answer" valueKey="form.submit" />
	<html:reset><bean:message key="form.reset" /></html:reset>
</logic:notPresent>

</html:form>

</body>
</html> 